Skip to content

fix: harden GitHub Actions workflows#2021

Merged
mnriem merged 1 commit intogithub:mainfrom
dagecko:runner-guard/fix-ci-security
Mar 31, 2026
Merged

fix: harden GitHub Actions workflows#2021
mnriem merged 1 commit intogithub:mainfrom
dagecko:runner-guard/fix-ci-security

Conversation

@dagecko
Copy link
Copy Markdown
Contributor

@dagecko dagecko commented Mar 30, 2026

Re-submission of #1985. Had a problem with my fork and had to delete it, which closed the original PR. Apologies for the noise.

Summary

This PR pins all GitHub Actions to immutable commit SHAs instead of mutable version tags and extracts any unsafe expressions from run blocks into env mappings.

How to verify

Review the diff, each change is mechanical and preserves workflow behavior:

  • SHA pinning: action@v3 becomes action@abc123 # v3, original version preserved as comment
  • No workflow logic, triggers, or permissions are modified

I've been researching CI/CD supply chain attack vectors and submitting fixes to affected repos. Based on that research I built a scanner called Runner Guard and open sourced it here so you can scan yourself if you want to. I'll be posting more advisories over the next few weeks on Twitter if you want to stay in the loop.

If you have any questions, reach out. I'll be monitoring comms.

- Chris (dagecko)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to harden CI supply-chain security by replacing mutable GitHub Actions version tags with immutable commit SHAs in existing workflows.

Changes:

  • Pin astral-sh/setup-uv to a specific commit SHA in the test workflow.
  • Pin DavidAnson/markdownlint-cli2-action to a specific commit SHA in the lint workflow.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/test.yml Pins astral-sh/setup-uv to a commit SHA in both jobs.
.github/workflows/lint.yml Pins markdownlint-cli2-action to a commit SHA.
Comments suppressed due to low confidence (1)

.github/workflows/test.yml:42

  • Same as above for the matrix job: actions/checkout and actions/setup-python are still referenced via mutable tags even though the PR description claims SHA pinning. Consider pinning them to commit SHAs, or update the PR description/scope accordingly.
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install uv
        uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v6

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Collaborator

@mnriem mnriem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address Copilot feedback

@dagecko
Copy link
Copy Markdown
Contributor Author

dagecko commented Mar 30, 2026

Good callout. The PR intentionally only pins third-party actions, not first-party actions under actions/* (checkout, setup-python, etc.). First-party actions are maintained by GitHub and have additional security controls, so the supply chain risk is lower. Updated the description to clarify.

- Chris (dagecko)

@dagecko
Copy link
Copy Markdown
Contributor Author

dagecko commented Mar 31, 2026

@mnriem just following up. I addressed the Copilot feedback in my comment above and updated the PR description to clarify the scope. Let me know if there is anything else needed.

  • Chris

@mnriem mnriem self-requested a review March 31, 2026 15:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mnriem mnriem merged commit 4dff63a into github:main Mar 31, 2026
16 checks passed
@mnriem
Copy link
Copy Markdown
Collaborator

mnriem commented Mar 31, 2026

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants